const shiftyRouter = (data) => {
  // 动态渲染路由
  let nData = []
  let home = {
    path: '/readme',
    component: resolve => require(['../components/common/home.vue'], resolve),
    children: [
      {
        path: '/',
        component: resolve => require(['../components/page/readme/readme.vue'], resolve)
      }
    ]
  }
  for (let i = 0; i < data.length; i++) {
    let obj = {}
    let path = data[i].modulePath
    obj.path = '/' + path
    obj.component = resolve => require([`../components/page/${path}/${path}.vue`], resolve)
    home.children.push(obj)
    let moduleItems = data[i].moduleItems
    for (let j = 0; j < moduleItems.length; j++) {
      let obj2 = {}
      let path2 = moduleItems[j].modulePath
      obj2.path = '/' + path2
      obj2.component = resolve => require([`../components/page/${path2}/${path2}.vue`], resolve)
      home.children.push(obj2)
    }
  }
  nData.push(home)
  return nData
}
export default shiftyRouter
